<form class="layui-form layui-card" action="{:request()->url()}" data-auto="true" method="post" autocomplete="off">
    <div class="layui-card-body padding-left-40">
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">父章节</span>
                <span class="color-desc margin-left-5">ParentName</span>
                <select class="layui-select" required name="pid" id="">
                    <option value="0">-- 父章节 --</option>
                    {foreach $pidlist as $item}
                    {if isset($vo.pid) and $vo.pid eq $item.id}
                    <option selected value="{$item.id}">{$item.name}</option>
                    {else}
                    <option value="{$item.id}">{$item.name}</option>
                    {/if}
                    {/foreach}
                </select>
            </label>
        </div>
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">章节名称</span>
                <span class="color-desc margin-left-5">Name</span>
                <input name="name" value='{$vo.name|default=""}' required pattern="^.{2,}$" placeholder="请输入章节名称" class="layui-input">
            </label>
        </div>
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">星级</span>
                <span class="color-desc margin-left-5">Star</span>
                <select class="layui-select" name="star" id="">
                    {foreach $star as $k=>$v}
                    {if isset($vo.star) and $vo.star eq $k}
                    <option selected value="{$k}">{$v}</option>
                    {else}
                    <option value="{$k}">{$v}</option>
                    {/if}
                    {/foreach}
                </select>
            </label>
        </div>
        <div class="layui-form-item">
            <label class="relative block">
                <span class="color-green font-w7">排序</span>
                <span class="color-desc margin-left-5">Sort</span>
                <input name="sort" value='{$vo.sort|default="0"}' placeholder="请输入排序，越大越靠前" class="layui-input">
            </label>
        </div>
    </div>

    <div class="hr-line-dashed"></div>
    {notempty name='vo.id'}<input type='hidden' value='{$vo.id}' name='id'>{/notempty}

    <div class="layui-form-item text-center">
        <button class="layui-btn" type='submit'>保存数据</button>
        <button class="layui-btn layui-btn-danger" type='button' data-confirm="确定要取消编辑吗？" data-close>取消编辑</button>
    </div>

</form>

<script>
    window.form.render();
</script>
